import fetch from 'common/src/utils/fetch';
// let apiPrefix = '/dev';
let apiPrefix = '/api/studentservice/';
/**
 * 分页查询
 * @param {data} data
 */
export function findListPage(data) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/page',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}

export function auditPage(data) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/auditPage',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}

/**
 * 新增
 */
export function addRequirePaperTemplate(data) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/addRequirePaperTemplate',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}

/**
 *修改
 * @param data
 */
export function updateRequirePaperTemplate(data) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/updateRequirePaperTemplate',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}

/**
 * 查询
 * @param data
 */
export function getRequirePaperTemplateById(id) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/getRequirePaperTemplateById?id=' + id,
    method: 'get'
  })
}

/**
 * 删除
 * @param id
 */
export function deleteRequirePaperTemplate(id) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/deleteRequirePaperTemplate?id=' + id,
    method: 'get'
  })
}

/**
 * 批量删除
 * @param id
 */
export function deleteTemplateList(idList) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/deleteTemplateList',
    method: 'post',
    data: {
      ids: idList
    }
  })
}

/**
 *保存模板
 * @param data
 */
export function saveTemplate(data) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/saveTemplate',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: data
  })
}
/**
 * 更新章节内容
 * @param data
 */
export function updateChapters(data) {
  return fetch({
    // url: '/api/cultureservice/bclCultureSchemeDetail/upateCultScheDetailOrTemplate',
    url: apiPrefix + 'requirePaperTemplate/updateChapters',
    method: 'post',
    data
  })
}
export function updateChaptersByZhao(data) {
  return fetch({
    // url: '/api/cultureservice/bclCultureSchemeDetail/upateCultScheDetailOrTemplate',
    url: apiPrefix + 'requirePaperTemplate/updateChaptersByZhao',
    method: 'post',
    data
  })
}

export function updateChapters2(data) {
  return fetch({
    // url: '/api/cultureservice/bclCultureSchemeDetail/upateCultScheDetailOrTemplate',
    url: apiPrefix + 'requirePaperTemplate/updateChaptersByZhao',
    method: 'post',
    data
  })
}

/**
 * 查询hashmap数据
 * @param id
 */
export function getPaperTemplateById(id) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/getPaperTemplateById?id=' + id,
    method: 'get'
  })
}

/**
 * 模板详情预览接口
 * @param id
 */
export function viewPaperTemplateById(id, lange) {
  return fetch({
    url: apiPrefix + 'requirePaperTemplate/viewPaperTemplateById?id=' + id + '&language=' + lange,
    method: 'get'
  })
}
/**
 * 导出word
 * */
export function exportPaperTemplateWord(id, lange) {
  return apiPrefix + 'requirePaperTemplate/exportPaperTemplateWord?id=' + id + '&language=' + lange
}

/**
 * 导出pdf
 * @param id
 */
export function exportPaperTemplatePdf(id, lange) {
  return apiPrefix + 'requirePaperTemplate/exportPaperTemplatePdf?id=' + id + '&language=' + lange
}

// (新)模板申请导出word(暂时不用)
export function exportApplyWord(trainingLevel, lange) { 
  return apiPrefix + 'requireTemplate/exportApplyWord?trainingLevel=' + trainingLevel + '&lange=' + lange
}

// (新)模板申请导出pdf(暂时不用)
export function exportApplyPdf(trainingLevel, lange) {
  return apiPrefix + 'requireTemplate/exportApplyPdf?trainingLevel=' + trainingLevel + '&lange=' + lange
}

// (新)学生模板申请导出word(暂时不用)

// (新)学生模板申请导出pdf(暂时不用)



export default {
  findListPage,
  auditPage,
  addRequirePaperTemplate,
  updateRequirePaperTemplate,
  getRequirePaperTemplateById,
  deleteRequirePaperTemplate,
  deleteTemplateList,
  saveTemplate,
  updateChapters, updateChapters2, updateChaptersByZhao,
  getPaperTemplateById,
  viewPaperTemplateById,
  exportPaperTemplateWord,
  exportPaperTemplatePdf,
  exportApplyWord, exportApplyPdf
}


